package com.xjrsoft.module.base.controller;


import com.xjrsoft.common.result.Response;
import com.xjrsoft.module.base.service.UserApiKeyService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author by lisen
 * @Version 1.0.0
 * @Date 2024-05-31 16:15
 * @projectName: xjrsoft_new
 * @package: com.xjrsoft.module.base.controller
 * @className: UserApiKeyController
 */
@RestController
@RequestMapping("/api-key")
public class UserApiKeyController {

    @Resource
    UserApiKeyService apiKeyService;
    @GetMapping("/newApiKey")
    public Response getApiKey(){
        String key = apiKeyService.getNewApiKey();
        if(key!=null){
            return Response.ok(key);
        }
        return Response.notOk("请求Api-Key失败");
    }
}
